<?php
class OrderItem extends Eloquent {
	protected $table = 'order_item';
	
	public function order()
	{
		return $this->blongsTo('Order');
	}

	public function product()
	{
		return $this->hasOne('Product', 'id', 'product_id');
	}
	
	public function subtotal()
	{
		return  round($this->price*$this->qty);
	}
}